package de.mmis.helferlein.demo;

import java.io.IOException;

import de.mmis.core.pojop.NetworkPublisher;
import de.mmis.core.pojop.NetworkPublisher.ServerType;
import de.mmis.core.pojop.server.Server;

public class MultiplierPublisher {
	public static void main(String[] args) throws IOException {
		// create a new multiplier object
		Multiplier m = new MultiplierImpl(3);

		// create a network publisher for the multiplier
		NetworkPublisher np = new NetworkPublisher(m, "M3");

		// create a new socket-interface on port 1234
		Server s = np.publish(ServerType.Socket, 1234);
		System.out.println("Socket server started on port " + s.getPort());

		// create a new socket-interface on port 1235
		Server t = np.publish(ServerType.Telnet, 1235);
		System.out.println("Telnet server started on port " + t.getPort());

		// create a new HTTP-interface on an arbitrary free port
		Server h = np.publish(ServerType.HTTP, 0);
		System.out.println("HTTP server started on port " + h.getPort());
	}
}
